tools/hv: Fix fortify format warning
authorBen Hutchings <ben@decadent.org.uk>
Fri, 25 Sep 2015 19:28:10 +0000 (20:28 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 30 Mar 2017 01:16:33 +0000 (01:16 +0000)
commitee99cc25ff6e2f5dfc70eabae3f414ff95703bc6
tree07f2eefd2bdf9240ed6883a505cee054718d2caa
parent3ac8421a782e451131dca8e5ecc5abf25169b141
tools/hv: Fix fortify format warning

With fortify enabled, gcc warns:

tools/hv/hv_kvp_daemon.c:705:2: error: format not a string literal and no format arguments [-Werror=format-security]
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  ^

kvp_net_dir is a pointer to a string literal, but lacks const
qualification.  As it is never modified, it should be a const
array rather than a pointer.

Also, while snprintf() has a bounds check, the following strcat()s
do not.  Combine them into a single snprintf().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-hv-fix-fortify-format-warning.patch
tools/hv/hv_kvp_daemon.c